package com.dgut.edu.cn.design.mode.filterchain.filter;

import com.dgut.edu.cn.design.mode.filterchain.dto.PriceCompareResult;
import com.dgut.edu.cn.design.mode.filterchain.dto.RuleFilterResVo;
import com.google.common.collect.Lists;
import org.springframework.stereotype.Service;
import java.util.*;

/**
 * @description:
 * @author: hongbin.zheng
 * @create: 2023-08-10 18:49
 **/
@Service
public class OpponentSiteRuleFilter implements RuleFilter<PriceCompareResult> {

	@Override
	public RuleFilterResVo doFilter(PriceCompareResult priceCompareResult) throws Exception{
		List<Long> siteList = Lists.newArrayList(1001L, 1002L);
		if (!siteList.contains(priceCompareResult.getOpponentPriceId())) {
			// 如果 站点非1001,1002 ，则过滤
			return RuleFilterResVo.fail("如果 站点非1001,1002 ，则过滤", name());
		}
		return RuleFilterResVo.ok(name());
	}

	@Override
	public String name() {
		return "opponentSiteRuleFilter";
	}
}
